package ihm;

import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;

import dao.DaoSpecialite;

public class Ajout_Artiste extends JFrame implements ActionListener
{

	private JPanel contentPane;
	private JLabel lblCodeArtiste;
	private JLabel lblNomArtiste;
	private JTextField txtCodeAjtArtiste;
	private JTextField txtNomAjtArtiste;
	private JLabel lblAjoutDunArtiste;
	private JButton btnAjouterAjtArtiste;
	private JButton btnAnnulerAjtArtiste;
	private JLabel lblPrnomArtiste;
	private JTextField txtPrnomArtiste;
	private JLabel lblDescriptionArtiste;
	private JTextField txtDescriptionAjtArtiste;
	private JLabel lblSpcialitArtiste;
	private JComboBox cbSpecAjtArtiste;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args)
	{
		EventQueue.invokeLater(new Runnable()
		{
			public void run()
			{
				try
				{
					Ajout_Artiste frame = new Ajout_Artiste();
					frame.setVisible(true);
				} catch (Exception e)
				{
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public Ajout_Artiste()
	{
		setTitle("Ajout d'un artiste");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 503, 320);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		lblCodeArtiste = new JLabel("Code :");
		lblCodeArtiste.setFont(new Font("Tahoma", Font.PLAIN, 14));
		lblCodeArtiste.setBounds(10, 75, 112, 20);
		contentPane.add(lblCodeArtiste);
		
		lblNomArtiste = new JLabel("Nom :");
		lblNomArtiste.setFont(new Font("Tahoma", Font.PLAIN, 14));
		lblNomArtiste.setBounds(10, 106, 96, 20);
		contentPane.add(lblNomArtiste);
		
		txtCodeAjtArtiste = new JTextField();
		txtCodeAjtArtiste.setColumns(10);
		txtCodeAjtArtiste.setBounds(114, 77, 112, 20);
		contentPane.add(txtCodeAjtArtiste);
		
		txtNomAjtArtiste = new JTextField();
		txtNomAjtArtiste.setColumns(10);
		txtNomAjtArtiste.setBounds(114, 108, 112, 20);
		contentPane.add(txtNomAjtArtiste);
		
		lblAjoutDunArtiste = new JLabel("Ajout d'un artiste");
		lblAjoutDunArtiste.setFont(new Font("Tahoma", Font.BOLD, 14));
		lblAjoutDunArtiste.setBounds(179, 11, 148, 26);
		contentPane.add(lblAjoutDunArtiste);
		
		btnAjouterAjtArtiste = new JButton("Ajouter");
		btnAjouterAjtArtiste.setBounds(209, 245, 118, 26);
		contentPane.add(btnAjouterAjtArtiste);
		
		btnAnnulerAjtArtiste = new JButton("Annuler");
		btnAnnulerAjtArtiste.addActionListener(this);
		btnAnnulerAjtArtiste.setBounds(369, 244, 118, 27);
		contentPane.add(btnAnnulerAjtArtiste);
		
		lblPrnomArtiste = new JLabel("Pr\u00E9nom :");
		lblPrnomArtiste.setFont(new Font("Tahoma", Font.PLAIN, 14));
		lblPrnomArtiste.setBounds(10, 142, 112, 20);
		contentPane.add(lblPrnomArtiste);
		
		txtPrnomArtiste = new JTextField();
		txtPrnomArtiste.setColumns(10);
		txtPrnomArtiste.setBounds(114, 144, 112, 20);
		contentPane.add(txtPrnomArtiste);
		
		lblDescriptionArtiste = new JLabel("Description :");
		lblDescriptionArtiste.setFont(new Font("Tahoma", Font.PLAIN, 14));
		lblDescriptionArtiste.setBounds(10, 173, 112, 20);
		contentPane.add(lblDescriptionArtiste);
		
		txtDescriptionAjtArtiste = new JTextField();
		txtDescriptionAjtArtiste.setColumns(10);
		txtDescriptionAjtArtiste.setBounds(114, 173, 112, 20);
		contentPane.add(txtDescriptionAjtArtiste);
		
		lblSpcialitArtiste = new JLabel("Sp\u00E9cialit\u00E9 :");
		lblSpcialitArtiste.setFont(new Font("Tahoma", Font.PLAIN, 14));
		lblSpcialitArtiste.setBounds(10, 204, 112, 20);
		contentPane.add(lblSpcialitArtiste);
		
		try {
			cbSpecAjtArtiste = new JComboBox(DaoSpecialite.getLesSpe());
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		cbSpecAjtArtiste.setBounds(114, 204, 114, 20);
		contentPane.add(cbSpecAjtArtiste);
		
	}
	public void actionPerformed(ActionEvent arg0) 
	{
			if (arg0.getSource() == btnAnnulerAjtArtiste) 
			 {	
		       	 dispose(); 
			 }

	}
}
